package com.yunxi.controller.sto;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.core.web.CurrentUser;
import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.LoginInfo;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import com.yunxi.sto.service.ReportPartnerYearDubboService;
import com.yunxi.sto.pojo.ReportPartnerYearVO;

/**
* <p>
*  前端控制器
* </p>
*
* @author Guan
* @since 2020-03-09
*/
@RestController
@RequestMapping("/admin/reportpartneryear")
@Api(tags = "STO:reportpartneryear", description = "接口")
public class ReportPartnerYearController {

    private static final Logger logger = LoggerFactory.getLogger(ReportPartnerYearController.class);

    @Autowired
    ReportPartnerYearDubboService reportPartnerYearDubboService;

    @GetMapping("/page")
    @ApiOperation(value = "查询分页")
    public ApiResult page(ReportPartnerYearVO reportPartnerYearVO, Integer pageNum, Integer pageSize) throws Exception {
        return ResponseUtil.ok(reportPartnerYearDubboService.findPageByVO(reportPartnerYearVO,pageNum,pageSize));
    }

    @GetMapping("/list")
    @ApiOperation(value = "查询列表")
    public ApiResult list(ReportPartnerYearVO reportPartnerYearVO) throws Exception {
        return ResponseUtil.ok(reportPartnerYearDubboService.listByVo(reportPartnerYearVO));
    }

    @GetMapping("/load")
    @ApiOperation(value = "读取单个")
    public ApiResult load(@RequestParam String id) throws Exception {
        return ResponseUtil.ok(reportPartnerYearDubboService.getById(id));
    }

    @PostMapping("/save")
    @ApiOperation(value = "保存信息")
    public ApiResult save(@RequestBody ReportPartnerYearVO reportPartnerYearVO) throws Exception {
        reportPartnerYearDubboService.saveOrUpdate(reportPartnerYearVO);
        return ResponseUtil.ok("success");
    }

    @PostMapping("/del")
    @ApiOperation(value = "删除")
    public ApiResult del(@RequestBody List<ReportPartnerYearVO> reportPartnerYearVOList) throws Exception {
        reportPartnerYearDubboService.removeByListVo(reportPartnerYearVOList);
        return ResponseUtil.ok("success");
    }

    /*@PostMapping("/export")
    @ApiOperation(value = "导出excel")
    public Object export(@RequestParam Map<String, Object> params) throws Exception {
        return ResponseUtil.ok(reportPartnerYearDubboService.findMapByList(params));
    }*/
}
